<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'custom-form',
	'enableAjaxValidation'=>false,
)); 
Yii::app()->clientScript->registerScript('admin', "
$(document).ready(function(){
		$('#payment').hide();
		$('#isreback').change(function(){
		var isreback = $(this).val();
			if(isreback==0){
				$('#payment').show();
			}else if(isreback=2){
				$('#Custom_payment_type').attr('value',0);
				$('#payment').hide();
			}
		})
	})
")
?>

	<p class="note"><?php echo Yii::t('base','Fields with <span class="required">*</span> are required.');?></p>


	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'custom_surname'); ?>
		<?php echo $form->textField($model,'custom_surname',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'custom_surname'); ?>
	</div>
	<div class="row">
		<?php echo $form->labelEx($model,'custom_name'); ?>
		<?php echo $form->textField($model,'custom_name',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'custom_name'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'telephone'); ?>
		<?php echo $form->textField($model,'telephone',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'telephone'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'email'); ?>
		<?php echo $form->textField($model,'email',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'email'); ?>
	</div>

	<div class="row">
		<?php echo $form->hiddenField($model,'agent_number'); ?>
		<?php echo $form->error($model,'agent_number'); ?>
	</div>
	<div class="row">
		<?php echo $form->labelEx($model,'custom_Passport'); ?>
		<?php echo $form->textField($model,'custom_Passport',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'custom_Passport'); ?>
	</div>

	<div class="row">
		<?php 
		if($model->equipment_number=="" && yii::app()->user->level()!=1){
		echo $form->labelEx($model,'equipment_number'); 
		}
		?>
		<?php 
		if(yii::app()->request->getParam(equipment_number)==""){
		if($model->equipment_number==""){
		echo $form->dropDownList($model,'equipment_number',UserService::model()->getAccessEquipmentNumber());}else{
			echo $form->hiddenField($model,'equipment_number',array('value'=>$model->equipment_number));
		}}else{
			echo $form->hiddenField($model,'equipment_number',array('value'=>yii::app()->request->getParam(equipment_number)));
		} ?>
		<?php echo $form->error($model,'equipment_number'); ?>
	</div>

	<div class="row">
		<?php if($this->action->id!='update'){?>
		<?php echo $form->labelEx($model,'package_id'); ?>
		<?php echo $form->dropDownList($model,'package_id',Package::model()->getPackageName()); ?>
		<?php echo $form->error($model,'package_id'); }else{
			echo $form->hiddenField($model,'package_id',array('value'=>$model->package_id));
		}?>
	</div>
	<?php echo $form->labelEx($model,'reback_time');?>
	<input class="Wdate" type="text" name="Custom[reback_time]" 
	 value="<?php echo $model->reback_time=='0000-00-00 00:00:00'?date("Y-m-d H:i:s",strtotime("+7 days")):$model->reback_time;?>" onClick="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" />
		<?php echo $form->error($model,'reback_time'); ?>
		<div class="row">
		<?php echo $form->labelEx($model,'reback_address'); ?>
		<?php echo $form->dropDownList($model,'reback_address',array('悉尼'=>'悉尼','墨尔本'=>'墨尔本','墨尔本唐人街'=>'墨尔本唐人街','上海'=>'上海')); ?>
		<?php echo $form->error($model,'reback_address'); ?>
		</div>
		<div class="row">
		<?php if($model->deposit==""){?>
		<?php echo $form->labelEx($model,'deposit');}?>
		<?php 
		if($model->deposit==""){
		echo $form->dropDownList($model,'deposit',array('150'=>'150澳币','99'=>'99澳币'));
}else{
	echo $form->hiddenField($model,'deposit',array('value'=>$model->deposit));
}?>
		<?php echo $form->error($model,'deposit');?>
		</div>
	<div class="row" >
	<?php echo  $form->labelEx($model,'isreback'); ?>
	<select id="isreback" name="isreback">
	<option value="2">待售</option>
	<option value="0">已售</option>
	</select>
	</div>
	<div class="row" id="payment">
		<?php echo $form->labelEx($model,'payment_type'); ?>
		<?php echo $form->dropDownList($model,'payment_type',array('0'=>'==请选择==','1'=>'现金','2'=>'刷卡','3'=>'银行转账')); ?>
		<?php echo $form->error($model,'payment_type'); ?>
	</div>
	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? Yii::t('base','Create') : Yii::t('base','Save')); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->